let pEles=document.querySelectorAll('p');
// let Leles=document.querySelectorAll('li');
let oo=document.querySelector('ol')
// console.log(oo.style.width)
let fn=async ()=>{
    let {status,info,id}=await isLogin();
    let r=await isLogin();
    console.log(r)
    if(status !=1){
        pEles[0].classList.add('active');
        pEles[1].classList.remove('active');
        // console.log(status)
        return;
    }
    pEles[0].classList.remove('active');
    pEles[1].classList.add('active');

    pEles[1].firstElementChild.innerHTML=info.nickname;

    pEles[1].addEventListener('click',async ({target})=>{
        if(target.className=='self') location.href='../views/self.html';
        if(target.className=='logout') {
            if(!confirm('确定要退出登录？')) return;
    
            localStorage.removeItem('token');
            localStorage.removeItem("id");
    
            await http.get('/users/logout',{params:{id}});
            alert('退出登录成功');
            fn();
        }
    })

}
fn();

// oo.style.marginLeft=-100+'px'
let min=0;
setInterval(function(){
    // let time=oo.getComputedStyle.marginLeft
    if(min==-8500) min=0
    oo.style.marginLeft=min+'px';
    min-=1700
},1000)